package de.tudarmstadt.ukp.muip.fibqdojo.util.japanese;

import de.tudarmstadt.ukp.muip.fibqdojo.interfaces.IFIBQToken;

public class JpyUtil {

    public static boolean isIchidanVerb(IFIBQToken token) {
        return isVerb(token) && isIchidan(token);
    }

    private static boolean isIchidan(IFIBQToken token) {
        String[] danPieces = PiecesUtil.getDanPieces(token);
        if (!(PiecesUtil.isWithinArrayBoundaries(danPieces, 0))) {
            return false;
        }
        if (danPieces[0].equals("一段")) {
            return true;
        }
        return false;
    }

    public static boolean isGoDanVerb(IFIBQToken token) {
        return isVerb(token) && isGoDan(token);
    }

    private static boolean isGoDan(IFIBQToken token) {
        String[] danPieces = PiecesUtil.getDanPieces(token);
        if (!(PiecesUtil.isWithinArrayBoundaries(danPieces, 0))) {
            return false;
        }
        if (danPieces[0].startsWith("五段")) {
            return true;
        }
        return false;
    }

    public static boolean isVerb(IFIBQToken token) {
        String[] posPieces = PiecesUtil.getPosPieces(token);
        return PiecesUtil.isWithinArrayBoundaries(posPieces, 0) && posPieces[0].startsWith("動詞");
    }

}
